fuelphpfandomcom-20200214-history
Fuelphp Wiki
General Model-View-ControllerModel-View-Controller- MVC is an approach to separating your code depending on what role it plays in your application. In the application flow it starts with a controller that is loaded. That Controller executes a method which retrieves data using Models. Once it is done the controller decides what View to load. HMVC Requests - HMVC requests are a great way to separate logic and re-use controller logic in multiple places. One common use of this is when you use a theme or template engine to generate your pages, where every page is divided into sections, and sections are populated by widgets. Controllers - Controllers are classes that can be reached through the URL and take care of handling the request. A controller calls models and other classes to fetch the information. Finally, it will pass everything to a view for output. Models - Whenever data needs to be retrieved, manipulated or deleted this should always be done by a model. A Model is a representation of some kind of data and has the methods to change them. Views - Views are files that present data to the browser. These files enable the separation of logic and presentation for your application. Views are typically html, javascript, or css but can contain variables passed into them from the controller. ViewModels - Optional; if you don't need them, you can use Views. A ViewModel is a class that contains the logic that is needed to generate your views. Routing Security Migrations - A convenient way for you to alter your database in a structured and organized manner. You could edit fragments of SQL by hand but you would then be responsible for telling other developers that they need to go and run them. You’d also have to keep track of which changes need to be run against the production machines next time you deploy. Coding Standards Other Classes Modules - A group of independent MVC elements. Packages - When it comes to organizing, reuse and share your code, packages are a great way to allow you to do this. They can contain all sorts of code like models, third-party libraries, configs and so on. Tasks - Classes that can be run through the command line or set up as a cron job. Classes Agent - Allows you to retrieve information about browser type, version, platform or operating system, etc, Arr - A set of helper functions for working with arrays. Asset - A set of methods to help with the collection, grouping and displaying of assets (js, css, img). Autoloader - Contains Fuel's autoloader function. It also supplies methods to interact with the autoloading process. Cache - Allows you to cache the result of a resource heavy operation. Cli - Interact with the command line by accepting input options, parameters and output text. Config - Handles nearly all configuration options in Fuel. Use this class whenever you need to load in a config file, get a value or set a value. Cookie - Allows you to get, set and delete cookies. Crypt - Allows you to encrypt or decrypt a string. Is also used internally (by the Fuel Sessions class for example). Database Date - A set of helper functions for working with dates. Contrary to PHP's DateTime class the Fuel Date class has full support for i18n. Debug - A simple utility for debugging variables, objects, arrays, etc by outputting information to the display. This is not meant as a one-stop-shop to all of your debugging needs, but as a simple way to throw out information quickly to check things as you go. Event - Allows you to interact with the Fuel Core without having to alter any core files. Fieldset - Used to create a form and handle its' validation in an object oriented way. It uses the Form and Validation classes. This class itself is only meant to model the fieldset and its fields while the other two classes do the real work. File - A set of methods to working with files & directories. This can be done through some helper methods or through a more advanced object oriented method where all files and directories are wrapped in objects. Form - The Form class can both be used to create individual form elements or to create a full form along with validation, the latter is done in combination with the Fieldset class. Format - Helps you convert between various formats such as XML, JSON, CSV, etc. Ftp - Allows you to upload, download, move and mirror files with remote servers over the FTP protocol. Fuel - Contains the core methods of the Fuel framework. Html - The html class is an html wrapper for nearly all html tags. Image - Used to easily add common manipulations to an image such as resizing, cropping, and so on. Inflector - Allows you to transforms words from singular to plural, class names to table names, modularized class names to ones without, and class names to foreign keys. Input - Allows you to access HTTP parameters, load server variables and user agent details. Lang - Allows you to set language variables using language files in your application. Log - Allows you to write messages to the log files. Migrate - Allows you to run, walk through and revert Migrations from your controllers. Pagination - Allows you to easily setup pagination for records you display. Redis - Allows you to interact with a Redis key-value store. Request - Processes URI requests. It is used by Fuel in index.php to process the users URI request, and you need it to generates request in an HMVC context. Response - Contains the methods to deal with HTTP response and browser output. Security - Allows you to have CSRF protection in your application. Session - Allows you to maintain state for your application in the stateless environment of the web. It allows you to store variables on the server using a variety of storage solutions, and recall these variables on the next page request. Str - A set of methods to help with the manipulation of strings. Upload - Allows you to securely process files that have been uploaded to the application. It allows you to filter uploads in various ways, define what the destination filenames should look like, or filter on size or length of the filename. Uri - Allows you to interact with the URI. Validation - Helps you validate user input, if you want to create a form & its validation at the same time use the Fieldset class instead View - Acts as an object wrapper for HTML pages with embedded PHP, called "views". Variables can be assigned with the view object and referenced locally within the view. Packages Oil - The Oil utility is a special package command can be used in several ways to facilitate quick development, help with testing your application and for running Tasks. Auth - The Auth package provides a standardized interface for authentication in Fuel. This allows users to write their own drivers and easily integrate a new driver to work with old code by keeping the basic methods consistent. Orm - Orm is short for Object Relational Mapper which does 2 things: it maps your database table rows to objects and it allows you to establish relations between those objects.